package com.ctshk.rpc.bus.mapper.provider;

import java.time.LocalDate;

import com.ctshk.common.service.mapper.CtsSQL;

/**
 * 巴士成本价格provider
 * 
 * @author Qiaoxin.Hong
 *
 */
public class BusProductCostPriceProvider {

	/**
     * 查询产品价格完整信息列表
     * @param productId
     * @param queryDate
     * @return
     */
	public String queryFullInfoList(Long productId, LocalDate queryDate) {
		return new CtsSQL() {{
			SELECT("t.id, t.cost_id, t.boarding_station_id, t.boarding_station_name, t.alighting_station_id");
			SELECT("t.alighting_station_name, t.passenger_id, t.passenger_name, t.price, t.number");
			SELECT("tbpc.bus_product_id, tbpc.cost_name, tbpc.currency_id, tbpc.currency_name");
			SELECT("tbpcd.id as dateId, tbpcd.date_begin, tbpcd.date_end");
			
			FROM("t_bus_product_cost_price t");
			JOIN("t_bus_product_cost tbpc on tbpc.id = t.cost_id");
			JOIN("t_bus_product_cost_date tbpcd on tbpcd.cost_id = tbpc.id");
			WHERE("tbpc.bus_product_id = #{productId} and tbpcd.date_begin <= #{queryDate} and tbpcd.date_end >= #{queryDate}");
		}}.toString();
	}
}
